<?php

// ***** Session.class *****
class Session{

  function Session(){
    session_start();
  }

  public function set($name,$value){
    $_SESSION[$name] = $value;
  }

  public function setRef($name,&$value){
    $_SESSION[$name] =& $value;
  }

  public function &get($name){
    $result = '';
    if (isset($_SESSION[$name])) {
  	  $result =& $_SESSION[$name];
    }
    return $result;
  }

  public function borrar_variable($name){
    unset ($_SESSION[$name]);
  }

  public function delete_session() {
    session_unset();
    session_destroy();
    session_start();
  }

} // end session.class


/* ***** Cookie.class ***** */
class Cookie{

function __constructor(){
  // nothing to do
}

public function set($name,$value,$expire=0,$path="/",$domain="",$secure=0){
  $expire += time(); // time in seconds
  setcookie($name,$value,$expire,$path,$domain,$secure);
}

public function get($name){
  if (isset($_COOKIE[$name])) {
    return $_COOKIE[$name];
  } else {
    return false;
  }
}

public function delete_cookie($name){
  setcookie($name,$value,$expire,$path,$domain,$secure);
}

} // end Cookie.class

?>